//
//  AlivcQuVideoModel.m
//  AliyunVideoClient_Entrance
//
//  Created by Zejian Cai on 2019/1/9.
//  Copyright © 2019年 Alibaba. All rights reserved.
//

#import "AlivcQuVideoModel.h"



@implementation AlivcQuVideoModel

//返回一个 Dict，将 Model 属性名对映射到 JSON 的 Key。
//+ (NSDictionary *)modelCustomPropertyMapper {
//    return @{
//             @"ID" : @"id",
//             @"title" : @"name",
//             @"coverUrl" : @"resourceUrl",
//             @"vid" : @"resourceId",
//             @"title" : @"name",
//             @"title" : @"name",
//             @"title" : @"name",
//
//    };
//}
- (instancetype)initWithDic:(NSDictionary *)dic{
    self = [super init];
    if (self) {
        
        _creationTimeString = dic[@"creationTime"];
        _transcodeStatusString = dic[@"transcodeStatus"];
        _snapshotStatusString = dic[@"snapshotStatus"];
        _censorStatusString = dic[@"censorStatus"];
        _narrowTranscodeStatusString = dic[@"narrowTranscodeStatus"];
       
        [self handleOriginalData];
    
    }
    return self;
}


/**
 处理二次包装的数据
 */
- (void)handleOriginalData{

    
    _transcodeStatus = [self statusWithString:_transcodeStatusString];
    _snapshotStatus = [self statusWithString:_snapshotStatusString];
    _ensorStatus = [self statusWithString:_censorStatusString];
    _narrowTranscodeStatus = [self statusWithString:_narrowTranscodeStatusString];
}

- (AlivcQuVideoAbstractionStatus )statusWithString:(NSString *)statusString{
    if ([statusString isEqualToString:@"success"]) {
        return AlivcQuVideoAbstractionStatus_Success;
    }
    if ([statusString isEqualToString:@"fail"]) {
        return AlivcQuVideoAbstractionStatus_Fail;
    }
    if ( [statusString isEqualToString:@"check"]) {
        return AlivcQuVideoAbstractionStatus_On;//如果是待审核的状态，客户端也是审核中的状态
    }
   
    return AlivcQuVideoAbstractionStatus_On;
}
@end
